async function ajaxGet(url, param) {
    let info = null;
    await axios.get(url, {params: param}).then(e => {
        info = e.data;
    })
    return info;
}

async function ajaxPost(url, param) {
    let info = null;
    let obj = new URLSearchParams();
    for (field in param) {
        obj.append(field, param[field]);
    }
    await axios.post(url, obj).then(e => {
        info = e.data;
    })
    return info;
}

function getObject(id){
    return document.getElementById(id);
}

function getQuery(variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
    }
    return(false);
}

function $(id){
    return document.getElementById(id);
}

function getFormData(param){
    let formData = new FormData();

    for(var fieldName in param){
        formData.append(fieldName, param[fieldName]);
    }
}

function getUploadConfig(){
    let config = {
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    }
    return config;
}